<script type="text/javascript">
    $(document).ready(function() { 
        $('.nobubble').click(function(event){
            event.stopImmediatePropagation();
        });
    });
</script>
<?php if( osc_count_items() == 0) { ?>
    <div class="search-header span11 columns">
        <h3>0 <?php _e('search results', 'twitter_bootstrap') ; ?></h3>
    </div>
    <div class="span11 columns" style="text-align:center;">
        <br>
        <?php if( osc_search_pattern() == '' ) { ?>
            <h2><?php _e('There are no results', 'twitter_bootstrap') ; ?></h2>
        <?php } else { ?>
            <h2><?php printf( __('There are no results matching "%s"', 'twitter_bootstrap'), osc_search_pattern() ) ; ?></h2>
        <?php } ?>
         <br>
    </div>
<?php } else { 
    
    $cat = twitter_breadcrumb_search('&nbsp; - &nbsp;');
    if ($cat != "")  {   
         $category   = osc_search_category_id();
         $category   = ((count($category) == 1) ? $category[0] : '');
        ?>
    <div class="alert-success" style="padding-left: 10px;margin-bottom: 5px;">
       <table>
       <tr>
           <td style="display:none;" >
               <span style="display:block;border-right: 1px solid #C8C8C8;height:25px;padding:0px 12px;">
               <img src="<?php echo osc_current_web_theme_url('images/cat/black_'. $category[0] .'.png'); ?>" width="30" alt="<?php echo osc_category_slug(); ?>" />
               </span>
           </td>
           <td>
             <?php
             $cat = twitter_breadcrumb_search('&nbsp; - &nbsp;');
             if ($cat != "")
                echo "<h1>" . twitter_breadcrumb_search('&nbsp; - &nbsp;') . " " . __('used2', 'twitter_bootstrap') . "</h1>"; 
             ?>
           </td>
       </tr>
       </table>
   </div>
 <?php } ?>
<div class="search-header span11 columns">    
    <p class="filters">
	<span style="margin-top:4px;font-weight:bold;font-size:12pt;float:left;" >
            <?php echo osc_search_total_items(); ?>
            <?php _e('search results', 'twitter_bootstrap') ; ?>
         </span>        
        
	<span style="float:right;">
            <strong><?php _e('Sort by', 'twitter_bootstrap'); ?></strong>
            <select onchange="window.location=this.options[this.selectedIndex].value;" style="width:150px;">
            <?php $i = 0 ; ?>
                <?php $orders = osc_list_orders('&raquo;');
                foreach($orders as $label => $params) {
                    $orderType = ($params['iOrderType'] == 'asc') ? '0' : '1'; ?>
                    
                    <?php if(osc_search_order() == $params['sOrder'] && osc_search_order_type() == $orderType) { ?>
                        <option selected="selected" value="<?php echo osc_update_search_url($params) ; ?>">
                        <?php echo $label; ?>
                        </option>
                    <?php } else { ?>
                        <option value="<?php echo osc_update_search_url($params) ; ?>">
                        <?php echo $label; ?>
                        </option>
                    <?php } ?>                    
                    <?php $i++ ; ?>                    
                <?php } ?>
            </select>
	</span>
    </p>
</div>
<?php
    osc_get_premiums() ;
    if( osc_count_premiums() > 0 ) {
?>
<?php while ( osc_has_premiums() ) { ?>
    <div class="premium line span11 columns"  >
        <div class="photo">
        <?php if( osc_count_premium_resources() ) { ?>
            <a href="<?php echo osc_premium_url() ; ?>">
                <img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="148px" height="110px" title="<?php echo osc_premium_title(); ?>" alt="<?php echo osc_premium_title(); ?>" />
            </a>
        <?php } else { ?>
            <!--<img src="<?php //echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="" title=""/>-->
			sin fotos
        <?php } ?>
        </div>
        <div class="description">
            <h3><?php if( osc_price_enabled_at_items() ) { ?> <strong><?php echo osc_premium_formated_price() ; ?></strong> &middot; <?php } ?><a href="<?php echo osc_premium_url() ; ?>"><?php echo osc_premium_title(); ?></a> <span class="label"><a href="<?php echo osc_item_category_url( osc_premium_category_id() ) ; ?>"><?php echo osc_premium_category() ; ?></a></span>
			</h3>
            <p><?php printf(__('<strong>Publish date</strong>: %s', 'twitter_bootstrap'), osc_format_date( osc_premium_pub_date() ) ) ; ?></p>
            <?php
                $location = array() ;
                if( osc_premium_country() != '' ) {
                    $location[] = sprintf( __('<strong>Country</strong>: %s', 'twitter_bootstrap'), osc_premium_country() ) ;
                }
                if( osc_premium_region() != '' ) {
                    $location[] = sprintf( __('<strong>Region</strong>: %s', 'twitter_bootstrap'), osc_premium_region() ) ;
                }
                if( osc_premium_city() != '' ) {
                    $location[] = sprintf( __('<strong>City</strong>: %s', 'twitter_bootstrap'), osc_premium_city() ) ;
                }

                if( count($location) > 0) { ?>
                    <p><?php echo implode(' &middot; ', $location) ; ?></p>
                <?php } ?>
            <p><?php echo osc_highlight( strip_tags( osc_premium_description() ), 200 ) ; ?></p>
        </div>
    </div>
    <?php } ?>
<?php } ?>
    <?php 
    $i = 1;
    while ( osc_has_items() ) { ?>
        <?php if($i == 3) { ?>
           <div class="lineAds span11 columns">  
<!--              <script type="text/javascript">
                google_ad_client = "ca-pub-1532681428717976";
                /* mercatrucks search */
                google_ad_slot = "1213403356";
                google_ad_width = 468;
                google_ad_height = 60;
                //
                </script>
                <script type="text/javascript"
                src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                </script>-->
              </div>
        <?php } else { ?>
            <div class="line span11 columns" onclick="location.href='<?php echo osc_item_url(); ?>'">        
                <div class="photo">
                  <a href="<?php echo osc_item_url() ; ?>"  class="nobubble">
                    <?php if( osc_count_item_resources() ) { ?>

                        <img src="<?php echo osc_resource_thumbnail_url() ; ?>" width="148px" height="110px" title="<?php echo osc_item_title(); ?>" alt="<?php echo osc_item_title(); ?>" />

                    <?php } else { ?>
                        <!--<img src="<?php //echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="" title=""/>-->
                        sin fotos
                    <?php } ?>
                  </a>
                </div>
                <div id="description" class="description">

                                <?php if( osc_price_enabled_at_items() && price_format(osc_item_formated_price()) != '') { ?>
                                    <span class="label green" >
                                    <strong style="font-size:11pt;text-transform: lowercase;margin-bottom:5px;">                            
                                        <?php echo price_format(osc_item_formated_price()); ?> 
                                    </strong>
                                    </span>
                                <?php } ?>

                                <span style="margin-top:5px;">
                                    <span style="float:right;">
                                        <span class="label grey2" >
                                            <a href="<?php echo osc_item_category_url(osc_item_category_id()) ; ?>"><?php echo osc_item_category(); ?></a>
                                        </span>
                                    </span> 

                                    <?php if( osc_item_is_premium() ) { ?> 
                                    <span style="float:right;">
                                    <span class="label success"><?php _e('Premium', 'twitter_bootstrap');  ?></span>
                                    </span><?php } ?>
                                    <span style="padding-right:20px;float:right;display:block;width:80px;text-align:right;">
                                    <?php  if( osc_item_region() != '' ) { ?>			

                                             <!--<img src="<?php //echo osc_current_web_theme_url('images/language/' . strtolower(osc_item_country()) . '.png'); ?>" />-->
                                             <?php echo osc_item_region(); ?>


                                    <?php } else { ?>
                                            &nbsp;
                                    <?php } ?>
                                    </span>
                                    <span style="padding-right:10px;float:right;"><?php echo osc_format_date( osc_item_pub_date() ) ; ?></span>			
                                </span>


                                <h3><a href="<?php echo osc_item_url() ; ?>"><?php echo osc_item_title(); ?></a></h3>


                    <?php
                     /*   $location = array() ;
                        if( osc_item_country() != '' ) {
                            $location[] = sprintf( __('<strong>Country</strong>: %s', 'twitter_bootstrap'), osc_item_country() ) ;
                        }
                        if( osc_item_region() != '' ) {
                            $location[] = sprintf( __('<strong>Region</strong>: %s', 'twitter_bootstrap'), osc_item_region() ) ;
                        }
                        if( osc_item_city() != '' ) {
                            $location[] = sprintf( __('<strong>City</strong>: %s', 'twitter_bootstrap'), osc_item_city() ) ;
                        }
                        if( count($location) > 0) {*/
                    ?>
                    <p><?php //echo implode(' &middot; ', $location) ; ?></p>
                    <?php //} ?>
                    <p style="color:#999999;text-transform: lowercase;"><?php echo osc_highlight(strip_tags(osc_item_description()), 150) ; ?></p>
                    <div style="padding-top:6px;display:none;">
                        <strong> 
                            <a href="<?php echo osc_item_url() ; ?>" style="color: #0066CC; text-decoration:underline;" class="nobubble">
                            <?php _e('see more details', 'twitter_bootstrap');  ?> 
                            <?php if(osc_count_item_resources() > 1) { 
                                echo ' '; 
                                _e('and', 'twitter_bootstrap');
                                echo ' ' . osc_count_item_resources() . ' ';
                                _e('photos', 'twitter_bootstrap'); 
                            } ?>
                            </a>
                        </strong>
                    </div>
                </div>
            </div>
        <?php } ?>
    
    <?php $i++; } ?>
<?php } ?>
<div class="pagination">
        <?php echo twitter_search_pagination() ; ?>
</div>